<form class="form-horizontal" role="form" method="post" action="<?=site_url('importw/index') ?>">  
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Tìm theo số lượng</label>
    <div class="col-sm-3">
      <input type="text" name="quantity" class="form-control" id="inputPassword3" placeholder="Nhập số lượng cần lưu kho.." value="<?=isset($quantity) ? $quantity : "" ?>">
    </div>
  </div>   
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Tìm theo kho</label>
    <div class="col-sm-3">
      <input type="text" name="storage" class="form-control" id="inputPassword3" placeholder="Gõ tên kho.." value="<?=isset($storage) ? $storage : "" ?>">
    </div>
  </div>   
  <button type="submit" name="addStorageBtn" value="add-all" class="btn btn-primary">Search</button>
</form>
<p></p>
<div class="table-responsive">
	<table class="table table-bordered" style="width:75%;">
		<tbody>
			<?php	
				$i = 1;			
				foreach ($allStorage as $storage):					
					if($i == 65)
					{
						echo '</tr>';
						$i = 1;
					}
					if($i == 1)
					{
						echo '<tr align="center">';
					}

					// nếu kho hết thì màu đen + disabled
					// nếu kho > 20 thì màu xanh

					$left_quantity = $storage->left_quantity;
					$total_quantity = $storage->total_quantity;

					if($left_quantity > 10 && $left_quantity < $total_quantity)
					{
						echo "<td class='success'><a href='".site_url('importw/process/'.$storage->id)."'>".$storage->title."</a> <span class='badge'>".$left_quantity."</span></td>";	
					}
					else if($left_quantity > 0 && $left_quantity < $total_quantity)
					{
						echo "<td class='warning'><a href='".site_url('importw/process/'.$storage->id)."'>".$storage->title."</a> <span class='badge'>".$left_quantity."</span></td>";	
					}
					else if($left_quantity <= 0)
					{
						echo "<td class='danger'><a href='".site_url('importw/process/'.$storage->id)."'>".$storage->title."</a> <span class='badge'>".$left_quantity."</span></td>";	
					}
					else
					{
						echo "<td class='active'><a href='".site_url('importw/process/'.$storage->id)."'>".$storage->title."</a> <span class='badge'>".$left_quantity."</span></td>";	
					}					

					$i++;
				endforeach;
			?>
		</tbody>
	</table>
</div>